<template>
  <div>
    <table>
      <tr>
        <td> 编号</td>
        <td> 图书名称</td>
        <td> 作者</td>
      </tr>
      <tr v-for="item in books">
        <td> {{item.id}}</td>
        <td> {{item.name}}</td>
        <td> {{item.author}}</td>
      </tr>
    </table>

<!-- <p> {{msg}}</p>-->
  </div>

</template>

<script>
export default {
  name: "Book",
  data() {
    return { //在这里写数据
      msg:'Hello Vue 丫丫',
      books: [
        {
          id: 1,
          name:'Java零基础实战',
          author:'宁楠'
        },
        {
          id: 2,
          name:'Vue零基础实战',
          author:'宁什'
        }

      ]

    }
  },
  created() {
    var that = this;

    axios.get('http://localhost:8181/book/findAll').then(
        function (resp){
          //这里的this指的是回调，需要处理。
          // console.log(resp.data)
          that.books = resp.data
        },function (err){console.log(err)}

    )

  }


}
</script>

<style scoped>

</style>